import java.util.Scanner;
public class DivisoresFactorial {

	public static void main(String[] args) {
		Scanner leer = new Scanner(System.in);
		long divisor;
		long dividendo;
		divisor = leer.nextLong();
		dividendo = leer.nextLong();

		while((divisor!=-1 || dividendo !=-1)){
			if(divisor<dividendo && divisor >1){
				divisor = 1;
			}else{
				if (divisor /2 < dividendo)
					dividendo= divisor /2;
				int i = (int) dividendo;
				while (i>1){
					if(divisor%i==0){
						divisor = divisor / i;
						
						if(divisor>i)
							break;
						else
							i = (int) divisor;
					}else
						if(divisor<i)
							i--;
						else
							break;
				}
			}
			if(divisor==1)
				System.out.println("YES");
			else
				System.out.println("NO");
			divisor = leer.nextLong();
			dividendo = leer.nextLong();

		}
		
	}

}
